/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

import { Request, Response } from 'express';
import { ResponseItem, responseSuccess } from '../../utils';
import Mock from 'mockjs';
export default {
  'GET /order/test': (req: Request, res: Response) => {
    return res.json({
      code: 0,
      msg: '',
    });
  },
  'POST /order/uploadSmsPhone': (req: Request, res: Response) => {
    const result: ResponseItem = {
      code: 0,
      msg: '成功',
      data: 'http://upload.kuaidihelp.com/admin/bond/csv/2021/12/保证金管理数据导出_20211229154844.csv',
    };
    return res.json(result);
  },
  'POST /order/SmsPhoneList': (req: Request, res: Response) => {
    const data = Mock.mock({
      'list|1-30': [
        {
          id: '@id()',
          task_name: '@cword(5)',
          sms_content: '@cword(10, 15)',
          sms_sign: '@cword(3, 4)',
          'sms_send_num|1-400': 400,
          sms_send_time: '@date()',
          export_user: '13783636923',
          create_time: '@date()',
        },
      ],
    });
    const result: ResponseItem = {
      code: 0,
      msg: '成功',
      data: {
        list: data.list,
        total: data.list.length,
      },
    };
    return res.json(result);
  },
  'POST /order/SmsPhoneDetailList': (req: Request, res: Response) => {
    const data = Mock.mock({
      'list|1-30': [
        {
          id: '@id()',
          phone: '@id()',
          task_id: '@id()',
          'is_look|1': ['0', '1'],
          create_time: '@date()',
        },
      ],
    });
    const result: ResponseItem = {
      code: 0,
      msg: '成功',
      data: {
        list: data.list,
        total: data.list.length,
      },
    };
    return res.json(result);
  },
  'POST /order/getRealPhone': (req: Request, res: Response) => responseSuccess(req, res),
  'POST /order/exportSmsPhone': (req: Request, res: Response) => responseSuccess(req, res),
  'POST /order/getPhoneRemarkList': (req: Request, res: Response) => {
    const data = Mock.mock({
      'list|1-30': [
        {
          'id|1-10000': 10000,
          phone_id: '@id()',
          created_at: '@now()',
          operator_name: '@ctitle(5)',
          content: '@cword(5, 10)',
          operator_phone: '13783636923',
        },
      ],
    });

    const result: ResponseItem = {
      code: 0,
      msg: '成功',
      data: data.list,
    };
    return res.json(result);
  },
  'POST /order/addPhoneRemark': (req: Request, res: Response) => responseSuccess(req, res),
  // 营销短信管理-发送营销短信列表
  'POST /MarketSms/getMarketSmsList': (req: Request, res: Response) => {
    const data = Mock.mock({
      'list|1-30': [
        {
          id: '@id',
          batch_number: '@id',
          'phone_cnt|1-1000': 1000,
          create_time: '@now',
          send_time: '@now',
          'status|1': ['build', 'wait', 'sending', 'sent'], //状态: build-未发送, wait-待发送, sending-发送中, sent-已发送'
          subject: '测试第一批',
          content: '这是一条手造测试短信',
          'sms_sign|1': ['微快递', '快宝驿站', '聚单客'],
          'data_source|1': ['excel', 'script'], // 数据来源: excel-自主导入, script-脚本导入'
          operator: 'shen',
          'is_timing|1': [0, 1],
        },
      ],
    });

    const result: ResponseItem = {
      code: 0,
      msg: '成功',
      data: {
        list: data.list,
        total_count: data.list.length,
      },
    };
    return res.json(result);
  },
  // 营销短信管理-批量发送营销短信创建
  'POST /MarketSms/createMarketBatchByExcel': (req: Request, res: Response) =>
    responseSuccess(req, res),
  // 营销短信管理-批量发送营销短信编辑
  'POST /MarketSms/updateMarketSmsList': (req: Request, res: Response) => responseSuccess(req, res),
  // 营销短信管理-单个发送营销短信提交
  'POST /MarketSms/resendSms': (req: Request, res: Response) => responseSuccess(req, res),
  'POST /MarketSms/getMarketSmsDetailList': (req: Request, res: Response) => {
    const data = Mock.mock({
      'list|1-30': [
        {
          id: '@id()',
          batch_id: '@id()',
          'batch_number|1-1000': 1000,
          report_id: '@id',
          mobile: '@phone()',
          send_time: '@now',
          'status|1': ['send', 'faild', 'receive'],
          sms_supplier: null,
          sms_sign: '',
          'real_cnt|1-1000': 1000,
          report_time: '@now',
          'note|1': ['备注', ''],
          'fail_reason|1': ['失败原因', ''],
          'is_look|1': ['0', '1'],
        },
      ],
    });
    const result: ResponseItem = {
      code: 0,
      msg: '成功',
      data: {
        list: data.list,
        total_count: data.list.length,
      },
    };
    return res.json(result);
  },

  'POST /MarketSms/getMarketSmsDetail': (req: Request, res: Response) => {
    const result: ResponseItem = {
      code: 0,
      msg: '成功',
      data: {
        mobile: '别看了别看了',
      },
    };
    return res.json(result);
  },
  // 营销短信管理-营销短信详情添加备注
  'POST /MarketSms/updateMarketSmsDetailNote': (req: Request, res: Response) =>
    responseSuccess(req, res),
};
